<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="ja" xml:lang="ja">
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<meta http-equiv="Content-Script-Type" content="text/javascript" />
		<meta http-equiv="Content-Style-Type" content="text/css" />
		<title>コントロールパネル</title>
		<link rel="stylesheet" href="./assets/styles/default.css" type="text/css" />
		
		<link rel="stylesheet" href="./assets/styles/ui-lightness/ui.all.css" type="text/css" />
		
		<link rel="stylesheet" href="./assets/styles/ui-lightness/jquery-ui-1.7.3.custom.css" type="text/css" />
		<link rel="stylesheet" href="./assets/styles/dialog.css" type="text/css" />
		
		<script src="assets/scripts/jquery-1.7.1.min.js" type="text/javascript"></script>
		<script src="assets/scripts/jquery-ui-1.7.3.custom.min.js" type="text/javascript"></script>
		<script src="assets/scripts/ui/ui.dialog.js" type="text/javascript"></script>
		
		<script src="assets/scripts/menu.js" type="text/javascript"></script>
		<script src="assets/scripts/table.js" type="text/javascript"></script>
		<script type="text/javascript" src="./assets/scripts/tiny_mce/tiny_mce.js"></script>
		<script type="text/javascript" src="./assets/scripts/editor.js"></script>
		<script type="text/javascript" src="./assets/scripts/ui/ui.datepicker.js"></script>
		<script type="text/javascript" src="./assets/scripts/ui/ui.core.js"></script>
		<script type="text/javascript" src="./assets/scripts/search.js"></script>
		<script type="text/javascript">
		$(function() {
			$('.message').fadeIn("slow");
			$('.btn_regist').click(function(){
				if( confirm('登録してよろしいですか？') ){
					document.fm.mode.value = 'input';
					document.fm.submit();
				}
			});
			
			$('.btn_update').click(function(){
				if( confirm('更新してよろしいですか？') ){
					document.fm.mode.value = 'input';
					document.fm.submit();
				}
			});
			$('.btn_return').click(function(){
				location.href = "mshop_index.php?hist=2";
			});
			$('#shop_c').click(function(){
				document.fm.parent_shop_cd.value = "";
				document.fm.parent_shop_name.value = "";	
			});
			
			$('.lnews').click(function(){
				mystr =  $(this).attr("id").split("_");
				$('#nsnmid'+  mystr[1] ).attr("value", "") ;
				
				$('#nsid'+  mystr[1] ).attr("value", "") ;
			});
			
			$("#block_cd").change(function(){
				document.fm.block_name.value = $("#block_cd").find("option:selected").text();
			});
			
			$("#local_cd").change(function(){
				document.fm.local_name.value = $("#local_cd").find("option:selected").text();
			});
			$('.text_date').datepicker({
				changeMonth: true,
				changeYear: true,
				dateFormat: 'yy/mm/dd'
			});
		});
		
		function setSS( valcd, valnm ) {
			if (gPara == "shop") {
				document.fm.parent_shop_cd.value = valcd;
				document.fm.parent_shop_name.value = valnm;
			} else {
				var thename = gPara.replace("_", "")				
				eval("document.fm." +  thename + ".value = '" + valcd+ "'");
				eval("document.fm." +  thename + "_name.value ='" + valnm + "'");		
			}
			
			//eval("document.fm." +  gPara + "_name.value ='" + valnm + "'");
			
			$('#dialog').dialog("close");
		}
		/*
		function setS(  valnm ) {
			//eval("document.fm." +  gPara + "_cd.value = " + valcd);
			eval("document.fm." +  gPara + "_name.value ='" + valnm + "'");			
			$('#dialog').dialog("close");
		}
		*/
		</script>
		
	</head>
	<body id="">
{{ $menu }}
{{ $logout }}
		<div id="container"><div class="wrapper">
			<h2>店舗マスター管理</h2>
			<ul class="submenu clearfix">
				<li><a href="mshop_index.php">店舗情報一覧</a></li>
				<li>店舗情報登録</li>
				<li><a href="mshop_import.php">CSV更新</a></li>
			</ul>
			<h3>店舗情報{{ if $forms.id == '' }}登録{{ else }}更新{{ /if }}{{ if $phase == 'complete' }}完了{{ /if }}</h3>
{{ if $phase == 'input' }}
			<p class="message">内容を確認し、{{ if $forms.id == '' }}登録{{ else }}更新{{ /if }}ボタンをクリックしてください。</p>
			<form name="fm" action="mshop_form.php" method="post">
				<table class="formTable">
					<tbody>
{{ if $forms.id != '' }}
						<tr>
							<th>更新日</th>
							<td>
								{{ $forms.u_time|date_format:"%Y/%m/%d %H:%M" }}<input type="hidden" name="u_time" value="{{ $forms.u_time }}" />
							</td>
						</tr>
						<tr>
							<th>更新者</th>
							<td>
								{{ $forms.m_user_name }}<input type="hidden" name="m_user_name" value="{{ $forms.m_user_name }}" />
							</td>
						</tr>
						<tr>
							<th>ID</th>
							<td>
								{{ $forms.id }}
							</td>
						</tr>
{{ /if }}

						<tr>
							<th><span>※</span>店舗コード</th>
							<td>
								<input type="text" name="shop_cd" class="text" value="{{ $forms.shop_cd|escape }}"  maxlangth="20" />{{ $err.shop_cd }}
							</td>
						</tr>
						<tr>
							<th><span>※</span>店舗名</th>
							<td>
								<input type="text" name="shop_name" class="text" value="{{ $forms.shop_name|escape }}"  maxlangth="100" />{{ $err.shop_name }}
							</td>
						</tr>

						<tr id = "tr_op4" >
							<th><span>※</span>地域ブロック</th>
							<td>
{{ html_options id='block_cd' name='block_cd' options=$block selected=$forms.block_cd }}{{ $err.block_cd }}
								<input type="hidden" name="block_name" value="{{ $forms.block_name }}" />
							</td>
						</tr>
						<tr>
							<th><span>※</span>都道府県</th>
							<td>
{{ html_options id='local_cd' name='local_cd'  options=$local selected=$forms.local_cd }}{{ $err.local_cd }}
								<input type="hidden" name="local_name" value="{{ $forms.local_name }}" />
							</td>
						</tr>
						<tr>
							<th><span>※</span>郵便番号</th>
							<td>
								<input type="text" name="postcode" class="text" value="{{ $forms.postcode|escape }}"  maxlangth="８" />(999-9999){{ $err.postcode }}
								
							</td>
						</tr>
						<tr>
							<th><span>※</span>電話番号</th>
							<td>
								<input type="text" name="tel" class="text" value="{{ $forms.tel|escape }}"  maxlangth="20" />(999-9999-9999){{ $err.tel }}
							</td>
						</tr>
						<tr>
							<th><span>※</span>住所</th>
							<td>
								<input type="text" name="address" class="text" value="{{ $forms.address|escape }}"  maxlangth="200" />{{ $err.address }}
							</td>
						</tr>
<!--						<tr>
							<th><span>※</span>SMXフラグ</th>
							<td>
{{ if $forms.smx == '1' }}
								<label><input  type="radio" name="smx" value="1" checked /> 設定する</label> <label><input  type="radio" name="smx" value="9" />設定しない</label> {{ $err.smx }}
								
{{ else }}
								<label><input  type="radio" name="smx" value="1" /> 設定する</label> <label><input  type="radio" name="smx" value="9" checked />設定しない</label> {{ $err.smx }}
{{ /if }}
								
							</td>
						</tr>
						<tr>
							<th><span>※</span>都心フラグ</th>
							<td>
{{ if $forms.center == '1' }} 
								<label><input  type="radio" name="center" value="1" checked /> 設定する</label> <label><input  type="radio" name="center" value="9" />設定しない</label> {{ $err.center }}
								
{{ else }}
								<label><input  type="radio" name="center" value="1" /> 設定する</label> <label><input  type="radio" name="center" value="9" checked />設定しない</label> {{ $err.center }}
{{ /if }}
							</td>
						</tr>-->
						<tr>
							<th>地域新聞1</th>
							<td>
								<input type="text"  id="nsid1" name="lnews1_name" class="text" value="{{ $forms.lnews1_name|escape }}"  readonly="readonly"/>
								<input type="hidden"  id="nsnmid1" name="lnews1"  value="{{ $forms.lnews1|escape }}" />
								<button type="button" id="lnews_1" class="btn_search" rel="pattern"><span>参照</span></button>
								<button type="button" class="lnews" id="cnews_1" ><span>クリア</span></button>{{ $err.lnews1 }}
							</td>
						</tr>
						<tr>
							<th>地域新聞2</th>
							<td>
								<input type="text"  id="nsid2"     name="lnews2_name" class="text" value="{{ $forms.lnews2_name|escape }}"  readonly="readonly"/>
								<input type="hidden"  id="nsnmid2"  name="lnews2"  value="{{ $forms.lnews2|escape }}" />
								<button type="button" id="lnews_2" class="btn_search" rel="pattern"><span>参照</span></button>
								<button type="button" class="lnews" id="cnews_2" ><span>クリア</span></button>{{ $err.lnews2 }}
							</td>
						</tr>
						<tr>
							<th>地域新聞3</th>
							<td>
								<input type="text"  id="nsid3" name="lnews3_name" class="text" value="{{ $forms.lnews3_name|escape }}"  readonly="readonly"/>
								<input type="hidden"  id="nsnmid3" name="lnews3"  value="{{ $forms.lnews3|escape }}" />
								<button type="button" id="lnews_3" class="btn_search" rel="pattern"><span>参照</span></button>
								<button type="button" class="lnews" id="cnews_3" ><span>クリア</span></button>{{ $err.lnews3 }}
							</td>
						</tr>
						<tr>
							<th>地域新聞4</th>
							<td>
								<input type="text"  id="nsid4" name="lnews4_name" class="text" value="{{ $forms.lnews4_name|escape }}" readonly="readonly" />
								<input type="hidden"  id="nsnmid4" name="lnews4"  value="{{ $forms.lnews4|escape }}" />
								<button type="button" id="lnews_4" class="btn_search" rel="pattern"><span>参照</span></button>
								<button type="button" class="lnews" id="cnews_4" ><span>クリア</span></button>{{ $err.lnews4 }}
							</td>
						</tr>
						<tr>
							<th>地域新聞5</th>
							<td>
								<input type="text"  id="nsid5" name="lnews5_name" class="text" value="{{ $forms.lnews5_name|escape }}" readonly="readonly" />
								<input type="hidden"  id="nsnmid5" name="lnews5"  value="{{ $forms.lnews5|escape }}" />
								<button type="button" id="lnews_5" class="btn_search" rel="pattern"><span>参照</span></button>
								<button type="button" class="lnews" id="cnews_5" ><span>クリア</span></button>{{ $err.lnews5 }}
							</td>
						</tr>
						<tr>
							<th>廃止日</th>
							<td>
								<input type="text" name="stop_date" class="text_date" value="{{ $forms.stop_date }}" />{{ $err.stop_date }}
							</td>
						</tr>
						<tr>
							<th><span>※</span>ゾーンAJA</th>
							<td>
								{{ html_options id='zone_aja' name='zone_aja'  options=$zoneuser selected=$forms.zone_aja }}{{ $err.zone_aja }}
							</td>
						</tr>
						<tr>
							<th><span>※</span>エリアAJA</th>
							<td>
								{{ html_options name='area_aja' options=$areauser selected=$forms.area_aja }}{{ $err.area_aja }}
							</td>
						</tr>
						
						<!--
						<tr>
							<th>親店舗</th>
							<td colspan="4">
								<input type="text" name="parent_shop_name" class="text" value="{{ $forms.parent_shop_name|escape }}" readonly="readonly" />
								<input type="hidden" name="parent_shop_cd"  value="{{ $forms.parent_shop_cd|escape }}" />
								<button type="button" id="shop" class="btn_search" rel="shop"><span>参照</span></button>
								<button type="button" id="shop_c" rel="shop"><span>クリア</span></button>
							</td>
						</tr>-->
						<tr>
							<th>備考</th>
							<td>
								<textarea name="memo" class="textarea"  style="width:380px" />{{ $forms.memo|escape }}</textarea>{{ $err.memo }}
							</td>
						</tr>
						<tr>
							<th>年商(億円)</th>
							<td>
								<input type="text" name="year_sale" class="text" value="{{ $forms.year_sale }}" />{{ $err.year_sale }}
							</td>
						</tr>
					</tbody>
				</table>
				<p class="button">
{{ if $forms.id != '' }}
					<button type="button" class="btn_return" class="submit"><span>戻る</span></button>
					<button type="button" class="btn_update" class="submit"><span>更新</span></button>
{{ else }}
					<button type="button" class="btn_regist" class="submit"><span>登録</span></button>
{{ /if }}
				</p>
				<input type="hidden" name="id" value="{{ $forms.id }}" />
				<input type="hidden" name="mode" value="" />
			</form>

<div id="dialog" >
</div>
 
{{ /if }}

{{ if $phase == 'complete' }}
			<p class="message">{{ $message }}</p>
			<ul>
{{ if $forms.id != '' }}
				<li>>> <a href="mshop_index.php?hist=2">一覧ページに戻る</a></li>
{{ else }}
				<li>>> <a href="mshop_index.php">一覧ページに戻る</a></li>
{{ /if }}
				<li>>> <a href="mshop_form.php">新規登録</a></li>
{{ if $forms.id != '' }}
				<li>>> <a href="mshop_form.php?id={{ $forms.id }}">更新</a></li>
{{ /if }}
			</ul>
{{ /if }}

		</div></div>
		{{ $footer }}
	</body>
</html>